<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">
<h:head>
	<title>Gerenciador de Livros</title>
</h:head>
<h:body>
	<h1>Gerenciador de Livros</h1>
	<h:dataTable var="livro" value="#{livroController.listarLivros}">
		<h:column>
			<f:facet name="header">
				<h:outputText value="Título" />
			</f:facet>
			<h:outputText value="#{livro.titulo}" />
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="Autor" />
			</f:facet>
			<h:outputText value="#{livro.autor}" />
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="Páginas" />
			</f:facet>
			<h:outputText value="#{livro.paginas}" />
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="Editora" />
			</f:facet>
			<h:outputText value="#{livro.editora}" />
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="Isbn" />
			</f:facet>
			<h:outputText value="#{livro.isbn}" />
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="Avaliação" />
			</f:facet>
			<h:outputText value="#{livro.avaliacao}" />
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="Alterar" />
			</f:facet>
			<h:form>
				<h:commandButton action="#{livroController.prepararAlterarLivro}"
					value="Alterar" />
			</h:form>
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="Excluir" />
			</f:facet>
			<h:form>
				<h:commandButton action="#{livroController.excluirLivro}"
					value="Excluir" />
			</h:form>
		</h:column>
	</h:dataTable>
	<br />
	<h:form>
		<h:commandLink value="Novo Livro"
			action="#{livroController.prepararAdicionarLivro}" />
	</h:form>
</h:body>
</html>